package com.aaa.a1102.demo03;

import java.util.concurrent.*;

/**
 * @author 荆豪峰
 * @version 1.0
 */
public class Test03 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        ExecutorService executorService = Executors.newFixedThreadPool(6);
        Future<Integer> submit = executorService.submit(new MyCallable());
        executorService.shutdown();
        System.out.println(submit.get());
    }
}
class MyCallable implements Callable<Integer>{

    @Override
    public Integer call() throws Exception {
        int sum=0;
        for (int i = 0; i <50;i++){
            sum +=i;
        }
        return sum;
    }
}